<template>
<div>
     <van-grid :gutter="10" >
  <van-grid-item  v-for="value in courselist" :key="value"  style="--van-grid-item-icon-size:150px"  @click="choseCourse(value.cno)">
     <van-icon name="label-o"/>
     <div><span >{{value.cno}}</span>&nbsp&nbsp
            
             <span v-if="value.status === 0">暂未结课  没有成绩</span>
             <span v-else>已经结课成绩为：{{value.result}}</span>
    </div>
    
 
</van-grid-item>
</van-grid>
</div>
</template>
<script>
   export default{
        data(){
            return{
                courselist:[],
                queryInfo:{
                query: '',
                // 当前的页数
                pagenum: 1,
                // 当前每页显示多少条数据
                pagesize: 10000000,
                //选择学号
                capacity:''
                },
            }
        },
        created(){
            this.getCourseList()
        },
        methods:{
            async getCourseList() {
                console.log(typeof window.sessionStorage.getItem('token'))
                console.log( window.sessionStorage.getItem('token'))
                this.queryInfo.query = window.sessionStorage.getItem('token')
                const { data: res } = await this.$http.post('studyRecordListSno',this.queryInfo
                )
                
                console.log(res)
                if (res === null) {
                return this.$message.error('获取课程数据失败！')
                }
                this.courselist = res
              
            },
            choseCourse(course_id){
       
       this.$router.push({
         name:'CourseDetailname',
         query:{
           id:course_id
         }
       })
    
    },
        }
   }
</script>